package org.ljdp.bootstrap;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

public class Testboot {

	public  void test(String[] args) {
		HelpFormatter formatter = new HelpFormatter();
		// create Options object
		Options options = new Options();
		options.addOption("name", true, "应用名称");
		options.addOption("web", true, "使用web模式启动，填写web应用目录，不设置则默认用jar方式启动");
		options.addOption("h", false, "帮助");
		
		// create the parser
	    CommandLineParser parser = new DefaultParser();
	    // parse the command line arguments
        try {
			CommandLine line = parser.parse( options, args );
			String appname = line.getOptionValue("name");
			if(line.hasOption("h")) {
	        	formatter.printHelp("LJDP", options );
	        }
			
			
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}
}
